package com.tide.crm.dao;

import java.util.List;
import java.util.Map;

import com.tide.crm.model.ConvergeAttachment;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;


@Mapper
public interface ConvergeAttachmentDao {

    @Select("select * from converge_attachment t where t.id = #{id}")
    ConvergeAttachment getById(Long id);

    @Delete("delete from converge_attachment where id = #{id}")
    int delete(Long id);

    int update(ConvergeAttachment convergeAttachment);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into converge_attachment(id,create_date, modify_date, description, file_suffix, file_type, order_list, path, source_name, osspath, status) values(#{id},#{createDate}, #{modifyDate}, #{description}, #{fileSuffix}, #{fileType}, #{orderList}, #{path}, #{sourceName}, #{osspath}, #{status})")
    int save(ConvergeAttachment convergeAttachment);
    
    int count(@Param("params") Map<String, Object> params);

    List<ConvergeAttachment> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
}
